<template>
    <div v-if="product">
        <common-banner :name="product.name" :breads="breads"></common-banner>
        <div class="page-center">
            <common-product-list :product-list="product.list"></common-product-list>
        </div>
    </div>
</template>
<script setup>
import { ref, onMounted } from 'vue'
import router from '@/router/index'
import CommonBanner from '@/components/CommonBanner.vue'
import CommonProductList from '@/components/CommonProductList.vue'

const breads = ref([{ name: 'product', label: '产品中心', to: true }])
const product = ref(null)

onMounted(() => {
    const { id } = router.currentRoute.query
    // TODO
    console.log(id)
    product.value = {
        id: 1,
        name: '贝尼地平',
        list: [
            {
                id: 1,
                name: '依托考昔杂质14',
                imageUrl: 'https://www.sincopharmachem.com.cn/Images/product/A18443.jpg',
                productId: 'E02291',
                casNo: '855307-79-8',
                formula: 'C18H13ClN2O2S',
                molecularWeight: '356.82',
            },
            {
                id: 2,
                name: '依托考昔杂质15',
                imageUrl: 'https://www.sincopharmachem.com.cn/Images/product/A18443.jpg',
                productId: 'E02291',
                casNo: '855307-79-8',
                formula: 'C18H13ClN2O2S',
                molecularWeight: '356.82',
            },
            {
                id: 3,
                name: '依托考昔杂质16',
                imageUrl: 'https://www.sincopharmachem.com.cn/Images/product/A18443.jpg',
                productId: 'E02291',
                casNo: '855307-79-8',
                formula: 'C18H13ClN2O2S',
                molecularWeight: '356.82',
            },
            {
                id: 4,
                name: '依托考昔杂质17',
                imageUrl: 'https://www.sincopharmachem.com.cn/Images/product/A18443.jpg',
                productId: 'E02291',
                casNo: '855307-79-8',
                formula: 'C18H13ClN2O2S',
                molecularWeight: '356.82',
            },
            {
                id: 5,
                name: '依托考昔杂质18',
                imageUrl: 'https://www.sincopharmachem.com.cn/Images/product/A18443.jpg',
                productId: 'E02291',
                casNo: '855307-79-8',
                formula: 'C18H13ClN2O2S',
                molecularWeight: '356.82',
            },
        ],
    }
    document.title = product.value.name
    breads.value.push({ name: product.value.id, label: product.value.name, to: false })
})
</script>
